package feeinterface.process;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;

import com.ulwx.type.TObject;

public  class ProcessorManager extends ProcessConfig{

	private static Logger log = Logger.getLogger(ProcessorManager.class);
	//新建一个Processor，必须在此处配置
	
	private static Processor[] ap= new Processor[processors.length];
	static{
		for(int i=0; i<processors.length; i++){
			try{
				ap[i]=(Processor)(processors[i].newInstance());
			}catch(Exception ex){
				log.error("",ex);
			}
		}
	}
	private static ProcessorManager pi=new ProcessorManager();
	
	private ProcessorManager(){
		
	}
	public static ProcessorManager getInstance(){
		if(pi==null){
			return new ProcessorManager();
		}
		else {
			return pi;
		}
			  
		  
	}

	public  void process(HttpServletRequest request,Map<String,String[]> parmMap,TObject bodyBytes)throws Exception
	{
		for(int i=0; i<ap.length; i++){
			Processor p=ap[i];
			p.process(request, parmMap,bodyBytes);
		}
		
	}
}
